layui.use(['ax','admin','form'], function () {
    var $ = layui.$;
    var $ax = layui.ax;
    var admin = layui.admin;
    var form = layui.form;
    form.render("select")

    var year = $("select[name='year']").val();
    var year = parseInt(year) + 1;
    $("select[name='targetYear']").empty();
    var option = '<option value="'+year+'">'+year+'年</option>'
    $("select[name='targetYear']").append(option)
    form.render("select")


    form.on("select(year)",function (data) {
        var year = parseInt(data.value) + 1;
        $("select[name='targetYear']").empty();
        var option = '<option value="'+year+'">'+year+'年</option>'
        $("select[name='targetYear']").append(option)
        form.render("select")
    })

    form.on("submit(btnSubmit)",function (data) {
        var ajax = new $ax(Feng.ctxPath + "/level/copy", function (data) {
            Feng.success("复制成功，请选择目标年度查看！");

            //传给上个页面，刷新table用
            admin.putTempData('formOk', true);

            //关掉对话框
            admin.closeThisDialog();
        }, function (data) {
            Feng.error("复制失败！" + data.responseJSON.message)
        });
        ajax.set(data.field);
        ajax.start();
    })
})